//
//  NSMutableDictionary+Add.m
//  MyFrameWork
//
//  Created by eason on 16/4/25.
//  Copyright © 2016年 普惠. All rights reserved.
//

#import "NSMutableDictionary+Add.h"

@implementation NSMutableDictionary (Add)

- (void)setStr:(id)obj forKey:(id<NSCopying>)aKey
{
    if (obj) {
        [self setObject:obj forKey:aKey];
        return;
    }
    [self setObject:@"" forKey:aKey];
}

- (void)setBool:(BOOL)obj forKey:(id<NSCopying>)aKey
{
    [self setStr:[NSString stringWithFormat:@"%d", obj] forKey:aKey];
}

- (void)setInt:(int)obj forKey:(NSString *)aKey
{
    NSNumber * intNumber = [[NSNumber alloc] initWithInt:obj];
    [self setValue:intNumber forKey:aKey];
}

- (void)setLong:(long)obj forKey:(NSString *)aKey
{
    NSNumber * longNumber = [[NSNumber alloc] initWithLong:obj];
    [self setValue:longNumber forKey:aKey];
}

- (void)setDouble:(double)obj forKey:(NSString *)aKey
{
    NSNumber * doubleNumber = [[NSNumber alloc] initWithDouble:obj];
    [self setValue:doubleNumber forKey:aKey];
}

@end
